from HTMLTestRunner import HTMLTestRunner
from classTesting1902.unittest_demo import suite_demo
import time

import unittest

suite = unittest.TestSuite()
# TestLoader类, 使用时后面要()
# 1.导入模块中的测试用例
test1 = unittest.TestLoader().loadTestsFromModule(suite_demo)
suite.addTests(test1)

now = time.strftime('%Y-%m-%d %H_%M_%S')  # 获取当前时间
filename = now + '_report.html'
fp = open(filename, 'wb')
runner = HTMLTestRunner(stream=fp, title='测试报告', description='测试用例执行情况')
runner.run(suite)
